<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:doc="livcos.org/ns/doc"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:v="livcos.org/ns/view"
  exclude-result-prefixes="doc xs v">

	<xsl:template match="doc:history">
    <table class="history">
    	<v:style ref="{resolve-uri('styles.css')}"/>
    	<thead>
        <tr>
          <th>Time</th>
          <th>Author</th>
          <th>History</th>
        </tr>
      </thead>
      <tbody>
        <xsl:apply-templates select="doc:record">
          <xsl:sort select="@time" order="descending"/>
        </xsl:apply-templates>
      </tbody>
    </table>
  </xsl:template>
  
  <xsl:template match="doc:record">
  	<xsl:variable name="time" select="xs:dateTime(if (@date) then concat(@date, 'T', @time) else @time)"/>
    <tr id="{@id}">
    	<td title="{format-dateTime($time, '[D01].[M01].[Y01] [H01]:[m01]:[s01]')}">
        <xsl:value-of
          select="format-dateTime($time, '[D01].[M01].[Y01]')"/>
      </td>
      <td align="center"><xsl:value-of select="@author"/></td>
			<td>
				<span class="inlineEdit">
					<span class="inlnEd_path" title="description"/>
					<xsl:value-of select="doc:description"/>
				</span>
			</td>
    </tr>
  </xsl:template>
  
</xsl:stylesheet>
